/*function changeStyle() {
    const x = document.getElementById("container");
    const y = document.getElementById("points");
    const z = document.getElementById("operate");
    const t = document.getElementById("body");
    const h = window.innerWidth;

    if (h >= 1024) {
        x.className = 'container';
        y.className = 'points';
        z.className = 'operate';
        t.className = 'body';
    } else {
        x.className = 'container1';
        y.className = 'points1';
        z.className = 'operate1';
        t.className = 'body1'
    }
}

// 初始化监听
window.addEventListener('load', changeStyle);
window.addEventListener('resize', changeStyle);
*/

function delete_button(id){
    
	fetch('/delete', {

        method: 'POST',
    
    
        headers: {
    
    
            'Content-Type': 'application/json'
    
    
        },
    
    
        body: JSON.stringify({ "id":id })
    
    
    })

    .then(location.reload())


    .then(data => console.log(data))


    .catch(error => console.error('Error:', error));

}

var clear_clz;

function clear_db(clear_class) {
    clear_clz = clear_class;
    container = document.getElementById("container");
    confirms = document.getElementById("confirms");
    container.style.display = "none";
    confirms.classList.add('display');
}

function confirmed(btn_id) {
    if (btn_id == 2) {
        fetch('/clear', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({ "class":clear_clz })
        })
        .then(location.reload())
        .then(data => console.log(data))
        .catch(error => console.error('Error:', error));
    }

    me = 'c' + String(btn_id);
    console.log(me);
    me2 = 'c' + String(btn_id+1);

    x = document.getElementById(me);
    x.classList.add('hidden');

    y = document.getElementById(me2);
    y.classList.remove('hidden');
    y.style.display = "block"; // 改为 block 显示模式
}


/*
function clear_db(clear_class) {
        
	fetch('/clear', {

        method: 'POST',
    
    
        headers: {
    
    
            'Content-Type': 'application/json'
    
    
        },
    
    
        body: JSON.stringify({ "class":clear_class })
    
    
    })

    .then(location.reload())


    .then(data => console.log(data))


    .catch(error => console.error('Error:', error));

}
    */